import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: resolve => require(['@views/Home'], resolve),
  },
  {
    path: '/login',
    component: resolve => require(['@views/Login'], resolve),
  },
  {
    path: '/register',
    component: resolve => require(['@views/Register'], resolve),
  },
  {
    path: '*',
    component: resolve => require(['@components/error/NotFound'], resolve),
  }
]

const router = new VueRouter({
  routes,
  scrollBehavior (to, from, savedPosition) {
    return { x: 0, y: 0 }
  }
})

// 路由拦截
// router.beforeEach((to, from) => {

// })

export default router;
